var roleCode = null;
var roleName = null;
var creationDate = null;
$(function(){
    roleCode = $("#roleCode");
    roleName = $("#roleName");
    creationDate = $("#creationDate");
    saveBtn = $("#save");
    backBtn = $("#back");

    creationDate.on("focus",function(){
        validateTip(creationDate.next(),{"color":"#666666"},"* 点击输入框，选择日期",false);
    }).on("blur",function(){
        if(creationDate.val() != null && creationDate.val() != ""){
            validateTip(creationDate.next(),{"color":"green"},imgYes,true);
        }else{
            validateTip(creationDate.next(),{"color":"red"},imgNo + " 选择的日期不正确,请重新输入",false);
        }
    });



    saveBtn.on("click",function(){
        /*roleCode.blur();
        roleName.blur();
        creationDate.blur();
        if(roleCode.attr("validateStatus") == "true"
            && roleName.attr("validateStatus") == "true"
            && creationDate.attr("validateStatus") == "true"
        ){
            if(confirm("是否确认要提交数据？")){
                $("#userForm").submit();
            }
        }*/
        if(confirm("是否确认要提交数据？")){
            $("#userForm").submit();
        }
    });

    backBtn.on("click",function(){
        //alert("modify: "+referer);
        if(referer != undefined
            && null != referer
            && "" != referer
            && "null" != referer
            && referer.length > 4){
            window.location.href = referer;
        }else{
            history.back(-1);
        }
    });
});